package com.jbm.onehome.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by lyh on 2017-04-14.
 */
@Entity
@Table(name = "payback", schema = "", catalog = "")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class PaybackEntity extends IAcross
{
    private int payId;
    private String payCode;
    private int balId;
    private BigDecimal amount;
    private int accId;
    private String accType;
    private String payType;
    private String paySerial;
    private String type;
    private String status;
    private Timestamp createDate;
    private int createId;
    private Timestamp expireDate;
    private Timestamp closeDate;
    private Integer closeId;
    private String caccType;
    private String memo;
    private String tradeNo;

	public PaybackEntity()
	{
		super();
	}

	public PaybackEntity(IAcross ia)
	{
		super(ia);
	}

    @Id
    @Column(name = "pay_id")
    @GeneratedValue
    public int getPayId() {
        return payId;
    }

    public void setPayId(int payId) {
        this.payId = payId;
    }

    @Basic
    @Column(name = "pay_code", nullable = true,  updatable = true, length = 20)
    public String getPayCode() {
        return payCode;
    }

    public void setPayCode(String payCode) {
        this.payCode = payCode;
    }

    @Basic
    @Column(name = "bal_id")
    public int getBalId() {
        return balId;
    }

    public void setBalId(int balId) {
        this.balId = balId;
    }

    @Basic
    @Column(name = "amount", precision = 2)
    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    @Basic
    @Column(name = "acc_id")
    public int getAccId() {
        return accId;
    }

    public void setAccId(int accId) {
        this.accId = accId;
    }

    @Basic
    @Column(name = "acc_type", length = 20)
    public String getAccType() {
        return accType;
    }

    public void setAccType(String accType) {
        this.accType = accType;
    }

    @Basic
    @Column(name = "pay_type", length = 20)
    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    @Basic
    @Column(name = "pay_serial", nullable = true,  updatable = true, length = 100)
    public String getPaySerial() {
        return paySerial;
    }

    public void setPaySerial(String paySerial) {
        this.paySerial = paySerial;
    }

    @Basic
    @Column(name = "type", length = 10)
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "status", length = 10)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "create_date", nullable = true,  updatable = true)
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "create_id")
    public int getCreateId() {
        return createId;
    }

    public void setCreateId(int createId) {
        this.createId = createId;
    }

    @Basic
    @Column(name = "expire_date", nullable = true,  updatable = true)
    public Timestamp getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Timestamp expireDate) {
        this.expireDate = expireDate;
    }

    @Basic
    @Column(name = "close_date", nullable = true,  updatable = true)
    public Timestamp getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Timestamp closeDate) {
        this.closeDate = closeDate;
    }

    @Basic
    @Column(name = "close_id", nullable = true,  updatable = true)
    public Integer getCloseId() {
        return closeId;
    }

    public void setCloseId(Integer closeId) {
        this.closeId = closeId;
    }

    @Basic
    @Column(name = "cacc_type", nullable = true,  updatable = true, length = 10)
    public String getCaccType() {
        return caccType;
    }

    public void setCaccType(String caccType) {
        this.caccType = caccType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PaybackEntity that = (PaybackEntity) o;

        if (accId != that.accId) return false;
        if (balId != that.balId) return false;
        if (createId != that.createId) return false;
        if (payId != that.payId) return false;
        if (accType != null ? !accType.equals(that.accType) : that.accType != null) return false;
        //if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
        if (caccType != null ? !caccType.equals(that.caccType) : that.caccType != null) return false;
        if (closeDate != null ? !closeDate.equals(that.closeDate) : that.closeDate != null) return false;
        if (closeId != null ? !closeId.equals(that.closeId) : that.closeId != null) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (expireDate != null ? !expireDate.equals(that.expireDate) : that.expireDate != null) return false;
        if (payCode != null ? !payCode.equals(that.payCode) : that.payCode != null) return false;
        if (paySerial != null ? !paySerial.equals(that.paySerial) : that.paySerial != null) return false;
        if (payType != null ? !payType.equals(that.payType) : that.payType != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (type != null ? !type.equals(that.type) : that.type != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = payId;
        result = 31 * result + (payCode != null ? payCode.hashCode() : 0);
        result = 31 * result + balId;
       // result = 31 * result + (amount != null ? amount.hashCode() : 0);
        result = 31 * result + accId;
        result = 31 * result + (accType != null ? accType.hashCode() : 0);
        result = 31 * result + (payType != null ? payType.hashCode() : 0);
        result = 31 * result + (paySerial != null ? paySerial.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + createId;
        result = 31 * result + (expireDate != null ? expireDate.hashCode() : 0);
        result = 31 * result + (closeDate != null ? closeDate.hashCode() : 0);
        result = 31 * result + (closeId != null ? closeId.hashCode() : 0);
        result = 31 * result + (caccType != null ? caccType.hashCode() : 0);
        return result;
    }

    @Basic
    @Column(name = "memo", nullable = true,  updatable = true, length = 50)
    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    @Basic
    @Column(name = "trade_no", nullable = true,  updatable = true, length = 50)
    public String getTradeNo() {
        return tradeNo;
    }

    public void setTradeNo(String tradeNo) {
        this.tradeNo = tradeNo;
    }
}
